package searchtab.preferences;

import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.RadioGroupFieldEditor;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;

public class PreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {


    public void init(IWorkbench workbench) {
        // Initialize the preference store we wish to use
         setPreferenceStore(PreferencesManager.getPreferenceStore());
    }
    
    @Override
    protected void createFieldEditors() {
        Composite fieldEditorParent = getFieldEditorParent();

        RadioGroupFieldEditor closeOnEscEditor = new RadioGroupFieldEditor(Preference.CLOSE_ON_ESC.getName(),
                "On ESC button pressed", 1, new String[][] { { "close Search Tab", "true" },
                        { "switch focus to active editor", "false" } }, fieldEditorParent);
        addField(closeOnEscEditor);
        BooleanFieldEditor higlightByDefaultEditor = new BooleanFieldEditor(Preference.DEFAULT_HIGHLIGHT.getName(), "Higlight by default", fieldEditorParent);
        addField(higlightByDefaultEditor);
        BooleanFieldEditor matchCaseByDefaultEditor = new BooleanFieldEditor(Preference.DEFAULT_MATCH_CASE.getName(), "Match case by default", fieldEditorParent);
        addField(matchCaseByDefaultEditor);

    }
}
